<template>
    <div class="presentrecord">
      <div class="record_list bg_colorff">
        <mt-loadmore :bottom-method="loadBottom" :bottom-all-loaded="allLoaded" ref="loadmore" :bottomDistance="bottomDistance" v-if="recordlist.length>0">
          <div class="record_list_item border_b p_l30 p_r30 p_b30 font_size28" v-for="(item,index) in recordlist" :key="index">
            <div class="flex line90 font_size28">
              <div class="lable color_33">提现姓名</div>
              <div class="color_33">{{item.real_name}}</div>
              <div class="flex-1 t_right color_fc">￥{{item.balance}}</div>
            </div>
            <div class="flex">
              <div class="lable color_33">到账银行</div>
              <div class="color_33">{{item.card_number}}</div>
            </div>
            <div class="flex">
              <div class="lable color_33">提现状态</div>
              <div class="color_33">{{item.status}}</div>
            </div>
          </div>
        </mt-loadmore>

        <div class="line90 t_center" v-if="recordlist.length<1">暂无数据</div>

      </div>
    </div>
</template>

<script>
    export default {
      name: "presentrecord",
      data(){
        return{
          pagesNum: 1, //当前页数
          maxPageNum: 0, //最大页数
          allLoaded: false, //是否宣布加载完
          isScroll: false,
          bottomDistance: 120,
          recordlist: []
        }
      },
      mounted(){
        this.getcordList(false)
      },
      methods:{
        getcordList(isScroll=true){
          console.log(isScroll)
          if (isScroll) {
            if (this.pagesNum >= this.maxPageNum) {
              this.pagesNum = this.maxPageNum;
              this.allLoaded = true;
              this.$toast("无更多数据");
              return;
            } else {
              this.pagesNum++;
            }
          } else {
            this.pagesNum = 1;
          }
          this.$util.get('user/getUserWithdrawList',{
            uid: this.$store.state.userinfo.uid,
            page: this.pagesNum
          }).then(data =>{
            this.maxPageNum = data.data.last_page
            this.recordlist = data.data.data
          })
        },
        loadBottom() {
          // 上拉加载
          this.getcordList(); // 上拉触发的分页查询
          this.$refs.loadmore.onBottomLoaded(); // 固定方法，查询完要调用一次，用于重新定位
        }
      }
    }
</script>

<style lang="less" scoped>
  .lable{
    width: 160px;
  }
</style>
